export type TCO<T> = Generator<TCO<T>, T, never>

export const run = <T>(t: TCO<T>): T => {
  let result
  while (result = t.next(), !result.done)
    t = result.value
  return result.value
}
